import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello, World!");
        URL url=new URL("http://rs.xidian.edu.cn/data/attachment/forum/202103/13/191640h50in82r8wktwgni.jpg");
        InputStream ips=url.openStream();
        File file =new File("1.jpg");
        FileOutputStream fops=new FileOutputStream(file);
        int len;
        byte[] buffer =new byte[20];
        while((len=ips.read(buffer))!=-1){
            fops.write(buffer, 0, len);
        }
        ips.close();
        fops.close();
    }
}
